Image processing apparatus and non-transitory computer readable medium storing program

ABSTRACT

An image processing apparatus includes a layout analyzing part that executes layout analysis for image data, an extraction part that extracts a diagrammatic representation from the image data by using a result of the layout analysis, a character recognizing part that executes character recognition for a partial area having a high probability of presence of a character string in a relationship with the extracted diagrammatic representation, and an erecting direction deciding part that decides an erecting direction of the image data by using a result of the character recognition.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is based on and claims priority under 35 USC 119 fromJapanese Patent Application No. 2018-010766 filed Jan. 25, 2018.

BACKGROUND (i) Technical Field

The present disclosure relates to an image processing apparatus and anon-transitory computer readable medium storing a program.

(ii) Related Art

Japanese Unexamined Patent Application Publication No. 2017-151493describes an image processing apparatus including an acquisition partand an output part for the purpose of outputting character informationto be recognized in an erecting direction of a document that is obtainedat a higher speed than in a case in which determination is made on theerecting direction by using image information of the entire document.The acquisition part acquires image information in a first area that isprovided for detection of an erecting direction of an image formed onthe document and is defined in advance based on a reference differentfrom that of a second area where character recognition is executed inthe image. The output part outputs character information in the secondarea that is recognized in the erecting direction of the image that isobtained based on the image information. Each character included in thepredetermined area is read in four directions of 0°, 90°, 180°, and 270°and is compared with character patterns in a predetermined dictionary.In each of the four directions, a character pattern in the dictionarythat has a closest feature is identified. At this time, a certaintyfactor indicating the degree of closeness of the feature is calculatedas well. A character pattern having a highest certainty factor among thecalculated certainty factors of the four directions is obtained as aresult of the character recognition and a direction in this case isdetermined as the erecting direction.

SUMMARY

Aspects of non-limiting embodiments of the present disclosure relate toa decrease in the accuracy of the erection determination that may becaused when determination is made on the erecting direction by executingcharacter recognition for only a predetermined fixed area irrespectiveof a result of layout analysis for a diagrammatic representation andwhen characters appropriate for the erection determination are notincluded in the predetermined fixed area.

Aspects of certain non-limiting embodiments of the present disclosureovercome the above disadvantages and/or other disadvantages notdescribed above. However, aspects of the non-limiting embodiments arenot required to overcome the disadvantages described above, and aspectsof the non-limiting embodiments of the present disclosure may notovercome any of the disadvantages described above.

According to an aspect of the present disclosure, there is provided animage processing apparatus comprising a layout analyzing part thatexecutes layout analysis for image data, an extraction part thatextracts a diagrammatic representation from the image data by using aresult of the layout analysis, a character recognizing part thatexecutes character recognition for a partial area having a highprobability of presence of a character string in a relationship with theextracted diagrammatic representation, and an erecting directiondeciding part that decides an erecting direction of the image data byusing a result of the character recognition.

BRIEF DESCRIPTION OF THE DRAWINGS

Exemplary embodiments of the present disclosure will be described indetail based on the following figures, wherein:

FIG. 1 is a configurational block diagram of an exemplary embodiment;

FIG. 2 is a functional block diagram of the exemplary embodiment;

FIG. 3 is a processing flowchart (part 1) of the exemplary embodiment;

FIG. 4 is a processing flowchart (part 2) of the exemplary embodiment;

FIG. 5 illustrates an example of an erection determination area of theexemplary embodiment;

FIG. 6 illustrates another example of the erection determination area ofthe exemplary embodiment;

FIG. 7 illustrates still another example of the erection determinationarea of the exemplary embodiment;

FIG. 8 is a processing flowchart of another exemplary embodiment;

FIG. 9 illustrates an example of an erection determination area of theother exemplary embodiment; and

FIG. 10 illustrates another example of the erection determination areaof the other exemplary embodiment.

DETAILED DESCRIPTION

Exemplary embodiments of the present disclosure are described below withreference to the drawings.

FIRST EXEMPLARY EMBODIMENT

First, the hardware configuration of an image processing apparatus 10 ofa first exemplary embodiment is described.

FIG. 1 is a configurational block diagram of the image processingapparatus 10. The image processing apparatus 10 is a so-calledmultifunction peripheral having, for example, a scanning function, aprinting function, a copying function, and a facsimile function. Theimage processing apparatus 10 includes a central processing unit (CPU)12, a read only memory (ROM) 14, a random access memory (RAM) 16, anoperation part 18, a display part 20, an image reading part 22, an imageforming part 24, an image processing part 26, a communication part 28,and a storage part 30. Those configurational blocks are connected to abus and exchange data via the bus.

The CPU 12 executes various programs such as an operating system (OS)and an application. The ROM 14 stores a control program to be executedby the CPU 12. The RAM 16 is used as, for example, a working memory forthe CPU 12. The CPU 12 reads the control program stored in the ROM 14and executes the control program by using the RAM 16 as a working area.When the control program is executed by the CPU 12, various functions ofthe image processing apparatus 10 are implemented.

The operation part 18 receives a user's operation for the imageprocessing apparatus 10. For example, the operation part 18 isconstructed of hardware keys or a touch panel that outputs a controlsignal based on a touch position. Any touch detecting means may be used,such as means for detecting a pressure generated by touch or detectingstatic electricity of a touched object.

For example, the display part 20 is constructed of a liquid crystaldisplay or an organic EL display and displays data on the imageprocessing apparatus 10. The display part 20 displays a screen to bereferenced by the user when the user operates the image processingapparatus 10. The display part 20 may be integrated with the operationpart 18.

The image reading part 22 reads images formed on documents 32 that areset, for example, on an auto document feeder (ADF) by the user andgenerates image data indicating the read images. For example, the imagereading part 22 is a scanner that may use a charge coupled device (CCD)system in which light is radiated from a light source onto a documentand the light reflected from the document is condensed by a lens andreceived by CCDs or a contact image sensor (CIS) system in which lightis sequentially radiated from an LED light source onto a document andthe light reflected from the document is received by a CIS. All thedocuments 32 are not always aligned in a fixed direction but may be setin any directions (randomly) as illustrated in FIG. 1.

The image forming part 24 includes a printing mechanism that forms animage on a recording medium such as paper. For example, the imageforming part 24 is a printer that may use an electrophotographic systemin which an image is formed by transferring, onto a recording medium,toner adhering to a photoconductor, an ink jet system in which an imageis formed by ejecting ink onto a recording medium, or a laser system.

The image processing part 26 performs image processing such as colorcorrection or tone correction for an image indicated by image data.

The communication part 28 is connected to a communication network (notillustrated) and communicates with a different apparatus connected tothe communication network. For example, image data is transmitted to orreceived from the different apparatus via the communication part 28. Thedifferent apparatus is a user terminal, a cloud server, or the like.

The storage part 30 has a storage area of a hard disk drive or the likeand stores, for example, data received via the communication part 28 anddata generated by the image processing apparatus 10. The storage part 30may store the control program to be executed by the CPU 12.

Based on the control program, the CPU 12 of the image processingapparatus 10 makes determination on erecting directions of theindividual documents 32 for image data generated by reading imagesformed on the documents 32 and outputs results of the determination. Forexample, the results of the determination on the erecting directions maybe used for recognizing characters included in the image data. Theerecting direction is a direction in which characters in an image may beread properly. For example, optical character recognition (OCR) is usedfor the determination on the erecting direction or the characterrecognition. The OCR is a technology in which characters in image dataare analyzed and converted into character data to be used by a computer.

Next, the functional configuration of the image processing apparatus 10is described.

FIG. 2 is a functional block diagram of the image processing apparatus10. As the functional blocks, the image processing apparatus 10 includesan image data acquiring part 101, a layout analyzing part 102, adiagrammatic representation extracting part 103, an erectiondetermination area identifying part 104, an OCR executing part 105, andan erecting direction determining part 106.

The image data acquiring part 101 acquires image data generated in sucha manner that the image reading part 22 reads an image formed on thedocument 32.

The layout analyzing part 102 analyzes the layout of the image includedin the image data acquired by the image data acquiring part 101. Forexample, the layout analyzing part 102 analyzes the layout of the imagein the image data by extracting a block of information (characters anddiagrammatic representations) based on a contrast to the background orby extracting a diagrammatic representation area based on a continuityof a color tone. In the exemplary embodiment, the layout analyzing part102 particularly analyzes a block of diagrammatic representations(including outline borders and gridlines) in the image data and theposition of the block. In this layout analysis, the pixel distributionof the diagrammatic representation is detected and a relative degree ofthe pixel distribution is analyzed. In particular, analysis is made foran area having a relatively higher degree of pixel distribution, thatis, a relatively higher frequency of presence of pixels than the otherarea.

The diagrammatic representation extracting part 103 determines whether adiagrammatic representation is included in the image data by using ananalysis result from the layout analyzing part 102. When thediagrammatic representation is included, the diagrammatic representationis extracted. The diagrammatic representation means at least one of adiagram and a table.

The erection determination area identifying part 104 identifies anerection determination area in the image data, in which erectiondetermination is to be made, by using the diagrammatic representationextracted by the diagrammatic representation extracting part 103. Theerection determination area identifying part 104 identifies, as theerection determination area, an area having a specific positionalrelationship with the extracted diagrammatic representation,specifically, an area having a high probability of presence of acharacter string that may be used for the erection determination. One ora plurality of erection determination areas may be identified. When aplurality of erection determination areas are identified, prioritylevels may be set for the plurality of erection determination areas. Thepriority level may be set higher in an area having a higher probabilityof presence of a character string. For example, priority is given to awide area or an area having a high frequency of presence of pixels.Description is given later of a specific area having a high probabilityof presence of a character string in the positional relationship withthe diagrammatic representation.

The OCR executing part 105 functions as a character recognizing part andexecutes OCR processing for the erection determination area identifiedby the erection determination area identifying part 104 to recognizecharacters included in the erection determination area. Specifically,the OCR executing part 105 reads each character included in the erectiondetermination area in, for example, four directions of 0°, 90°, 180°,and 270° and compares the character with character patterns in apredetermined dictionary. In each of the four directions, the OCRexecuting part 105 identifies a character pattern in the dictionary thathas a closest feature and calculates its certainty factor. The certaintyfactor is a ratio indicating how feature points of a character of arecognition target and a character of a recognition result match witheach other. Any method may be used for calculating the certainty factor.For example, when a distance between a feature vector extracted frominput image data and a feature vector in an OCR dictionary is calculatedand a character in the dictionary that is closest to the input characteris selected and output as a recognition result, an index value r iscalculated based on the following expression by using inverses ofdistance values of a first candidate character and a second candidatecharacter of the recognition result.r=v1/(v1+v2)

In this expression, v1 and v2 are inverses of the distance values of thefirst candidate character and the second candidate character,respectively. Through evaluation against characters for learning thatare collected in advance, histograms of the value r with respect tocharacters that are recognized correctly and characters that are notrecognized correctly are determined and the certainty factor iscalculated by using the histograms.

The erecting direction determining part 106 functions as an erectingdirection deciding part and makes determination on an erecting directionof each character by using the certainty factor calculated by the OCRexecuting part 105. The erecting direction determining part 106determines that a direction having a highest frequency of determinationis the erecting direction of the image data and outputs the determineddirection. For example, when the erection determination area includesfive characters and it is determined that the direction of 0° is theerecting direction for the first to fourth characters and the directionof 180° is the erecting direction for the fifth character, the erectingdirection determining part 106 determines that the direction of 0° isthe erecting direction of the image data.

The functional blocks of FIG. 2 are implemented in such a manner thatthe CPU 12 executes a processing program. A part of the functionalblocks may be implemented through hardware processing instead ofsoftware processing that involves execution of a program. The hardwareprocessing may be performed by using a circuit such as anapplication-specific integrated circuit (ASIC) or a field-programmablegate array (FPGA).

Next, the processing of the exemplary embodiment is described taking atable as an example of the diagrammatic representation.

FIG. 3 and FIG. 4 are processing flowcharts of the exemplary embodiment.The processing is executed by the CPU 12 based on the processingprogram.

First, when the image data acquiring part 101 acquires image data, theimage data is input to the layout analyzing part 102 (S101). The layoutanalyzing part 102 executes layout analysis for the image data andoutputs an analysis result to the diagrammatic representation extractingpart 103. In the layout analysis, a block of diagrammaticrepresentations is extracted. When the diagrammatic representation is atable, outline borders and gridlines are extracted as continuous linesthat constitute the table. By extracting outline borders and gridlines,information on the size, the position, and the numbers of rows andcolumns of the table is obtained. Further, information on the widths ofrows and columns is obtained and information on a relationship among therelative degrees of the widths is obtained as well.

The diagrammatic representation extracting part 103 determines whether atable is included in the image data by using layout analysis data(S102). When a table is extracted (YES in S102), a character directionin a horizontally-oriented rectangular area on the outline of the tableis detected (S103). That is, the erection determination area identifyingpart 104 identifies a horizontally-oriented rectangular area on theoutline of the extracted table as the erection determination area andoutputs the erection determination area to the OCR executing part 105.When the table is regarded as a matrix, the horizontally-orientedrectangular area on the outline of the table means an uppermost row or alowermost row. A row direction means a direction perpendicular to, forexample, a long-side direction of A4 copy paper. In other words, the rowdirection means a direction parallel to a short-side direction of A4copy paper. Specifically, when the table is constituted by five rows andfour columns, the horizontally-oriented rectangular area on the outlineof the table means the uppermost first row or the lowermost fifth row.The OCR executing part 105 executes OCR for the identified area in fourdirections of 0°, 90°, 180°, and 270°, calculates certainty factors, andoutputs the certainty factors to the erecting direction determining part106. The erecting direction determining part 106 detects the characterdirection in the erection determination area by using the calculatedcertainty factors.

After the character direction in the erection determination area hasbeen detected, the erecting direction determining part 106 determineswhether the direction of the image data is confirmed (S104). Forexample, the erecting direction determining part 106 executes theprocessing of S103 for all the characters in the erection determinationarea. When a direction having a highest frequency of determination ispresent, the erecting direction determining part 106 determines that thedirection is confirmed (YES in S104), outputs the confirmed direction asthe erecting direction, and terminates the processing. When thedirection is not confirmed, for example, when the frequencies of 0° and90° are substantially equal to each other, the erecting directiondetermining part 106 determines that the direction is not confirmed (NOin S104) and proceeds to the next processing.

In the next processing, the erection determination area identifying part104 determines whether the size of a vertically-oriented rectangulararea on the outline of the extracted table is equal to or larger than athreshold (S105). When the table is regarded as a matrix, thevertically-oriented rectangular area on the outline of the table means aleftmost column or a rightmost column. A column direction means adirection parallel to, for example, a long-side direction of A4 copypaper. Specifically, when the table is constituted by five rows and fourcolumns, the vertically-oriented rectangular area on the outline of thetable means the leftmost first column or the rightmost fourth column.For example, the threshold is set in relation to the width of the columnand may be set as a width at which a minimum number of charactersnecessary for the erection determination may be present. The thresholdmay be set by using the number of pixels corresponding to the minimumnumber of characters necessary for the erection determination. When thesize is equal to or larger than the threshold (YES in S105), a characterdirection in the vertically-oriented area on the outline is detected(S106). That is, the erection determination area identifying part 104identifies a vertically-oriented rectangular area on the outline of theextracted table as the erection determination area and outputs theerection determination area to the OCR executing part 105. The OCRexecuting part 105 executes OCR for the identified area in fourdirections of 0°, 90°, 180°, and 270°, calculates certainty factors, andoutputs the certainty factors to the erecting direction determining part106. The erecting direction determining part 106 detects the characterdirection in the erection determination area by using the calculatedcertainty factors.

After the character direction in the erection determination area hasbeen detected, the erecting direction determining part 106 determineswhether the direction of the image data is confirmed (S107). Forexample, the erecting direction determining part 106 executes theprocessing of S106 for all the characters in the erection determinationarea. When a direction having a highest frequency of determination ispresent, the erecting direction determining part 106 determines that thedirection is confirmed (YES in S107), outputs the confirmed direction asthe erecting direction, and terminates the processing. When thedirection is not confirmed, for example, when the frequencies of 0° and90° are substantially equal to each other, the erecting directiondetermining part 106 determines that the direction is not confirmed (NOin S107) and detects the direction by another method (S108). When atable is not included in the image data in S102, the erecting directiondetermining part 106 similarly detects the direction by another method(S108).

When the result of S105 is NO, that is, when the direction is notconfirmed in the horizontally-oriented rectangular area on the outlineof the table and in the vertically-oriented rectangular area on theoutline of the table, the processing proceeds to processing of FIG. 4.

In FIG. 4, the erection determination area identifying part 104determines whether the size of a rectangular area inwardly adjacent tothe vertically-oriented rectangular area of the extracted table is equalto or larger than the threshold (S109). When the table is regarded as amatrix, the inwardly-adjacent vertically-oriented rectangular area meansa column inwardly adjacent to the left end or a column inwardly adjacentto the right end. Specifically, when the table is constituted by fiverows and four columns, the inwardly-adjacent vertically-orientedrectangular area means the second column or the third column. When thesize is equal to or larger than the threshold (YES in S109), a characterdirection in the inwardly-adjacent vertically-oriented area is detected(S110). That is, the erection determination area identifying part 104identifies an inwardly-adjacent vertically-oriented rectangular area asthe erection determination area and outputs the erection determinationarea to the OCR executing part 105. The OCR executing part 105 executesOCR for the identified area in four directions of 0°, 90°, 180°, and270°, calculates certainty factors, and outputs the certainty factors tothe erecting direction determining part 106. The erecting directiondetermining part 106 detects the character direction in the erectiondetermination area by using the calculated certainty factors.

After the character direction in the erection determination area hasbeen detected, the erecting direction determining part 106 determineswhether the direction of the image data is confirmed (S111). Forexample, the erecting direction determining part 106 executes theprocessing of S110 for all the characters in the erection determinationarea. When a direction having a highest frequency of determination ispresent, the erecting direction determining part 106 determines that thedirection is confirmed (YES in S111), outputs the confirmed direction asthe erecting direction, and terminates the processing. When thedirection is not confirmed, for example, when the frequencies of 0° and90° are substantially equal to each other, the erecting directiondetermining part 106 determines that the direction is not confirmed (NOin S111) and detects the direction by another method (S112).

As described above, in this exemplary embodiment, the erectiondetermination area identifying part 104 identifies thehorizontally-oriented rectangular area on the outline of the table, thevertically-oriented rectangular area on the outline of the table, andthe vertically-oriented rectangular area inwardly adjacent to thevertically-oriented rectangular area on the outline of the table as theerection determination areas and makes determination on the erectingdirection of the image data. The horizontally-oriented rectangular areaon the outline of the table, the vertically-oriented rectangular area onthe outline of the table, and the vertically-oriented rectangular areainwardly adjacent to the vertically-oriented rectangular area on theoutline of the table are identified as the areas having a highprobability of presence of a character string that may be used for theerection determination. Those areas are decided by using relativepositions in the extracted diagrammatic representation. Next, thoseareas are described in more detail.

FIG. 5 illustrates an example of the horizontally-oriented rectangulararea on the outline of the table that is identified as the erectiondetermination area in S103. A table 200 is constituted by an outline anda plurality of gridlines. Horizontally-oriented rectangular areas 202and 204 on the outline are present at the upper end and the lower end ofthe table, respectively. The horizontally-oriented rectangular area 202corresponds to a rectangular area in a first row and thehorizontally-oriented rectangular area 204 corresponds to a rectangulararea in a fifth row. The names of entries in the respective rows aregenerally placed in the horizontally-oriented rectangular area 202 atthe upper end. For example, “ITEM”, “QUANTITY”, “UNIT”, “UNIT PRICE”,and “AMOUNT” are placed. For example, the total of the respective rowsis placed in the horizontally-oriented rectangular area 204 at the lowerend. For example, “SUBTOTAL” is placed. Focusing on the fact that acharacter string is often included statistically or customarily in thehorizontally-oriented rectangular area 202 at the upper end and thehorizontally-oriented rectangular area 204 at the lower end, theerection determination area identifying part 104 identifies thehorizontally-oriented rectangular areas 202 and 204 as the erectiondetermination areas by using this fact. Compared with those areas, anumber string is relatively often included at an inner part of the tableand therefore the accuracy of the erection determination may decrease.Since a character string is often included statistically or customarilyin the horizontally-oriented rectangular area 202 at the upper end andthe horizontally-oriented rectangular area 204 at the lower end, thedecrease in the determination accuracy is suppressed by using thecharacter string in those areas.

The erection determination area identifying part 104 may identify atleast one of the horizontally-oriented rectangular area 202 at the upperend and the horizontally-oriented rectangular area 204 at the lower endas the erection determination area. The erection determination areaidentifying part 104 may first identify the horizontally-orientedrectangular area 202 at the upper end as the erection determination areaand then identify the horizontally-oriented rectangular area 204 at thelower end as the erection determination area when the erecting directionis not confirmed. Specifically, for example, a direction along the longside of A4 copy paper is defined as a vertical direction. OCR isexecuted while identifying the horizontally-oriented rectangular area202 at the upper end under the assumption that one side in the verticaldirection is an upper side. When the erecting direction is notconfirmed, OCR is executed while identifying the horizontally-orientedrectangular area 204 at the lower end under the assumption that a sideopposite the upper side in the vertical direction is a lower side.

FIG. 6 illustrates an example of the vertically-oriented rectangulararea on the outline of the table that is identified as the erectiondetermination area in S105. A vertically-oriented rectangular area 206is present at the left end of the table 200. The vertically-orientedrectangular area 206 corresponds to a rectangular area in a firstcolumn. The names of entries in the respective columns are generallyplaced in the vertically-oriented rectangular area 206 at the left end.For example, “ITEM”, “MULTI-LOGGER”, “BASE SET”, “EXTENSION TERMINAL”,and “SUBTOTAL” are placed.

Focusing on the fact that a character string is often includedstatistically or customarily in the vertically-oriented rectangular area206 at the left end, the erection determination area identifying part104 identifies the vertically-oriented rectangular area 206 as theerection determination area by using this fact.

FIG. 6 illustrates the vertically-oriented rectangular area 206 at theleft end but the erection determination area identifying part 104 mayidentify a vertically-oriented rectangular area at the right end as theerection determination area. The erection determination area identifyingpart 104 may identify at least one of the vertically-orientedrectangular area at the left end and the vertically-oriented rectangulararea at the right end as the erection determination area. Thevertically-oriented rectangular area at the right end corresponds to arectangular area in a fifth column.

In S105, the vertically-oriented rectangular area is identified as theerection determination area only when the size of thevertically-oriented rectangular area is equal to or larger than thethreshold. This operation is performed in consideration of the fact thata character string is not included with a relatively high probabilitywhen the size of the vertically-oriented rectangular area, that is, thesize of the vertically-oriented rectangular area in a lateral directionis small because only numerals or symbols are placed.

FIG. 7 illustrates an example of the vertically-oriented rectangulararea that is inwardly adjacent to the vertically-oriented rectangulararea on the outline of the table and is identified as the erectiondetermination area in S110. A vertically-oriented rectangular area 208is present so as to be inwardly adjacent to the vertically-orientedrectangular area at the left end of the table 200, that is, so as toneighbor the vertically-oriented rectangular area at the left end in thelateral direction. The vertically-oriented rectangular area 208corresponds to a rectangular area in a second column. Only “No.” andnumerals are placed in the vertically-oriented rectangular area at theleft end but the names of entries in the respective columns are placedin the inwardly-adjacent vertically-oriented rectangular area 208. Forexample, “ITEM”, “SOFTWARE DEVELOPMENT”, “DESIGNING”, “IMPLEMENTATION”,“GENERAL AND ADMINISTRATIVE EXPENSES”, and “SUBTOTAL” are placed.

Focusing on the fact that a character string is often includedstatistically or customarily in the inwardly-adjacentvertically-oriented rectangular area 208 compared with thevertically-oriented rectangular area at the left end, the erectiondetermination area identifying part 104 identifies thevertically-oriented rectangular area 208 as the erection determinationarea by using this fact.

When the extracted table is regarded as a matrix having m rows and ncolumns with respect to the long side or the short side of the table,the horizontally-oriented rectangular area on the outline of the tableand the vertically-oriented rectangular area on the outline of the tablecorrespond to the following row or column.

Horizontally-oriented rectangular area on outline of table: first row orm-th row

Vertically-oriented rectangular area on outline of table: first columnor n-th column

Those areas may be represented as areas including the outline of thetable. When the lengths of the outline borders of the extracted tableare different from each other, those areas may be represented as areasto which the longest side belongs. For example, thehorizontally-oriented rectangular areas 202 and 204 of FIG. 5 are theareas to which the longest side of the table belongs. Thevertically-oriented rectangular area 206 of FIG. 6 is an area to whichthe second longest side belongs.

When the table is regarded as a matrix having m rows and n columns, thevertically-oriented rectangular area inwardly adjacent to thevertically-oriented rectangular area on the outline of the tablecorresponds to the following column.

Vertically-oriented rectangular area inwardly adjacent tovertically-oriented rectangular area on outline of table: second columnor (n−1)th column

This area may be represented as an area adjacent to the area includingthe outline of the table.

The horizontally-oriented rectangular area on the outline of the tableis an area where the names of entries in the respective rows are placedand therefore tends to be relatively wider than the other rows. Focusingon this fact, the widest area among the areas including the outline ofthe table may be identified as the erection determination area.

SECOND EXEMPLARY EMBODIMENT

In the first exemplary embodiment, the horizontally-oriented rectangulararea on the outline of the table, the vertically-oriented rectangulararea on the outline of the table, and the vertically-orientedrectangular area inwardly adjacent to the vertically-orientedrectangular area on the outline of the table are identified as theerection determination areas and determination is made on the erectingdirection of the image data. In addition, there may be an area where acharacter string that may be used for the erection determination isincluded with a high probability in the positional relationship with thediagrammatic representation. Examples of this area include an area wherethe title of the diagrammatic representation is placed.

FIG. 8 is a processing flowchart of a second exemplary embodiment. FIG.8 is different from FIG. 3 in terms of processing of detecting acharacter direction in an area near the table when the table isextracted in S102 (S201). That is, when a block of image data is presentwithin a predetermined distance from the outline of the extracted table,more specifically, within a predetermined distance from the upper end ofthe outline or the lower end of the outline, the erection determinationarea identifying part 104 identifies an area of the block as theerection determination area while the area is regarded as an area of thetitle of the diagrammatic representation. For example, the upper end ofthe outline means one side in the long-side direction of A4 copy paperand the lower end of the outline means the other side in the long-sidedirection of A4 copy paper.

The erection determination area identifying part 104 outputs theidentified erection determination area to the OCR executing part 105.The OCR executing part 105 executes OCR for the identified area in fourdirections of 0°, 90°, 180°, and 270°, calculates certainty factors, andoutputs the certainty factors to the erecting direction determining part106. The erecting direction determining part 106 detects the characterdirection in the erection determination area by using the calculatedcertainty factors.

After the character direction in the erection determination area hasbeen detected, the erecting direction determining part 106 determineswhether the direction of the image data is confirmed (S202). Forexample, the erecting direction determining part 106 executes theprocessing of S201 for all the characters in the erection determinationarea. When a direction having a highest frequency of determination ispresent, the erecting direction determining part 106 determines that thedirection is confirmed (YES in S202), outputs the confirmed direction asthe erecting direction, and terminates the processing. When thedirection is not confirmed, for example, when the frequencies of 0° and90° are substantially equal to each other, the erecting directiondetermining part 106 determines that the direction is not confirmed (NOin S202) and executes the processing of S103 and other subsequentprocessing in FIG. 3.

As described above, the area near the diagrammatic representation, inwhich the title of the diagrammatic representation is placed, isidentified as the erection determination area in addition to thehorizontally-oriented rectangular area on the outline of the table, thevertically-oriented rectangular area on the outline of the table, andthe vertically-oriented rectangular area inwardly adjacent to thevertically-oriented rectangular area on the outline of the table. Thus,the decrease in the erection determination accuracy is suppressed.

FIG. 9 illustrates an example of an area where the title of a table isplaced. A title area 210 of “TABLE 1. LIST OF SOFTWARE EXPENSES” ispresent above the table 200, specifically, within a predetermineddistance from the upper end of the outline of the table. The title area210 is identified as the erection determination area.

FIG. 10 illustrates an example of an area where the title of a diagramis placed. A title area 302 of “FIG. 1. FREQUENCY DISTRIBUTION” ispresent above a diagram 300, specifically, within a predetermineddistance from the upper end of the diagram. The title area 302 isidentified as the erection determination area.

In the first and second exemplary embodiments, the upper, lower, right,and left parts of the table may uniquely be decided based on the longside of copy paper. For example, a direction along the long side of A4copy paper is defined as a vertical direction and one side in thevertical direction is defined as an upper part while the other side isdefined as a lower part. After the upper part and the lower part havebeen decided, a direction along the short side of A4 copy paper isdefined as a lateral direction. The upper, lower, right, and left partsmay be decided based on the short side of copy paper but this decisionis substantially equivalent to the decision based on the long side ofcopy paper. If no title is present in FIG. 9 within a predetermineddistance from the upper end of the outline of the table 200 that isdefined as described above, the erecting direction of the table may be adirection rotated by 90° or 270°. In this case, it is appropriate thatOCR be executed for an area within a predetermined distance from theleft end or the right end of the outline of the table 200. The sameapplies to the case of FIG. 10. In short, it is appropriate that an areawithin a predetermined distance from the outline of the table 200 (inthe vertical or lateral direction) be identified as the erectiondetermination area. The predetermined distance is generally a fixedvalue but may be a variable through the user's setting.

Modified examples are described below.

MODIFIED EXAMPLE 1

In the first exemplary embodiment, the horizontally-oriented rectangulararea on the outline of the table, the vertically-oriented rectangulararea on the outline of the table, and the vertically-orientedrectangular area inwardly adjacent to the vertically-orientedrectangular area on the outline of the table are identified as theerection determination areas and the priority levels are provided forthose areas. As the priority order, the following order is set.

1. Horizontally-oriented rectangular area on outline of table

2. Vertically-oriented rectangular area on outline of table

3. Vertically-oriented rectangular area inwardly adjacent tovertically-oriented rectangular area on outline of table

Any other priority order may be set. For example, the following ordermay be set.

1. Vertically-oriented rectangular area on outline of table

2. Vertically-oriented rectangular area inwardly adjacent tovertically-oriented rectangular area on outline of table

3. Horizontally-oriented rectangular area on outline of table

The same applies to the second exemplary embodiment. In the secondexemplary embodiment, the horizontally-oriented rectangular area on theoutline of the table, the vertically-oriented rectangular area on theoutline of the table, the vertically-oriented rectangular area inwardlyadjacent to the vertically-oriented rectangular area on the outline ofthe table, and the area of the title of the diagrammatic representationare identified as the erection determination areas and the prioritylevels are provided for those areas. As the priority order, thefollowing order is set.

1. Area of title of diagrammatic representation

2. Horizontally-oriented rectangular area on outline of table

3. Vertically-oriented rectangular area on outline of table

4. Vertically-oriented rectangular area inwardly adjacent tovertically-oriented rectangular area on outline of table

Any other priority order may be set. For example, the following ordermay be set.

1. Vertically-oriented rectangular area on outline of table

2. Vertically-oriented rectangular area inwardly adjacent tovertically-oriented rectangular area on outline of table

3. Horizontally-oriented rectangular area on outline of table

4. Area of title of diagrammatic representation

This setting corresponds to such a setting that the processing “DETECTBY OTHER METHOD” in S108 and S112 of FIG. 3 and FIG. 4 is processing ofidentifying the area of the title of the diagrammatic representation asthe erection determination area.

The priority level of the erection determination area may be variableinstead of being fixed. The priority level may be variable through theuser's setting. Specifically, the user sets the priority level for eachtype of diagrammatic representation included in the image data. Thetitle area is set to the first place in the priority order for a certaintype of diagrammatic representation while the horizontally-orientedrectangular area on the outline of the table is set to the first placein the priority order for a different type of diagrammaticrepresentation.

MODIFIED EXAMPLE 2

In the first and second exemplary embodiments, the vertically-orientedrectangular area inwardly adjacent to the vertically-orientedrectangular area at the left end is identified as the erectiondetermination area when the size of the vertically-oriented rectangulararea at the left end, that is, the lateral length of thevertically-oriented rectangular area at the left end is equal to orsmaller than the threshold or when the direction is not confirmed eventhough the size is equal to or larger than the threshold. In place ofthe inwardly-adjacent vertically-oriented rectangular area, avertically-oriented rectangular area having a largest size in the rowdirection (width) in the table may be extracted and identified as theerection determination area. Specifically, when a vertically-orientedrectangular area corresponding to a third column from the left end iswidest in a table having five columns, the vertically-orientedrectangular area in the third column is identified as the erectiondetermination area.

MODIFIED EXAMPLE 3

In the first and second exemplary embodiments, for example, when thehorizontally-oriented rectangular area on the outline of the table isidentified as the erection determination area, the erecting directionsand their certainty factors are calculated for the entire characterstring in the horizontally-oriented rectangular area and a directionhaving a highest frequency of determination is finally confirmed as theerecting direction of the image data. The erecting direction of theimage data may be confirmed when OCR is sequentially executed for acharacter string present in an area identified as the erectiondetermination area and a sufficiently large certainty factor is obtainedfor a certain character, for example, when a certainty factor equal toor larger than a reference value (for example, 98%) is obtained for acertain character. That is, there is no need to execute OCR andcalculate certainty factors for the entire character string in theerection determination area. The reference value may be fixed as adefault value but may be a variable that may be set by the user.

MODIFIED EXAMPLE 4

In the exemplary embodiments, when the table is regarded as a matrix, awidest row or column is identified as the erection determination area. Apixel density obtained as a result of the layout analysis may be usedand a row or column having a highest pixel density (highest frequency ofpresence) may be identified as the erection determination area.Alternatively, a widest row or column having a highest pixel density maybe identified as the erection determination area.

MODIFIED EXAMPLE 5

In the exemplary embodiments, when the table is regarded as a matrix, arow or column that satisfies a predetermined condition is identified asthe erection determination area. The row or column may be plural.Specifically, in a matrix having m rows and n columns, a plurality ofrows less than m rows or a plurality of columns less than n columns maybe identified as the erection determination areas. Further, a row and acolumn that satisfy a predetermined condition may be identified as theerection determination areas. For example, the first row and the firstcolumn, the first row and the second column, or the first row, the m-throw, and the first column may be identified.

The foregoing description of the exemplary embodiments of the presentdisclosure has been provided for the purposes of illustration anddescription. It is not intended to be exhaustive or to limit thedisclosure to the precise forms disclosed. Obviously, many modificationsand variations will be apparent to practitioners skilled in the art. Theembodiments were chosen and described in order to best explain theprinciples of the disclosure and its practical applications, therebyenabling others skilled in the art to understand the disclosure forvarious embodiments and with the various modifications as are suited tothe particular use contemplated. It is intended that the scope of thedisclosure be defined by the following claims and their equivalents.

What is claimed is:
 1. An image processing apparatus, comprising: aprocessor, configured to: execute layout analysis for image data;extract a diagrammatic representation from the image data by using aresult of the layout analysis; execute character recognition for apartial area having a high probability of presence of a character stringin a positional relationship with the extracted diagrammaticrepresentation; and decides decide an erecting direction of the imagedata by using a result of the character recognition for the partialarea.
 2. The image processing apparatus according to claim 1, whereinthe partial area is decided based on a relative position in theextracted diagrammatic representation.
 3. The image processing apparatusaccording to claim 1, wherein, when the extracted diagrammaticrepresentation has m rows and n columns (m and n are natural numbers)with respect to a long side or a short side of the image data, thepartial area is an area in a first row or an m-th row.
 4. The imageprocessing apparatus according to claim 3, wherein, when the extracteddiagrammatic representation has the m rows and the n columns (m and nare natural numbers) with respect to the long side or the short side ofthe image data and when the erecting direction is not confirmed as aresult of the character recognition for the first row that is executed,the m-th row is then set as the partial area.
 5. The image processingapparatus according to claim 1, wherein, when the extracted diagrammaticrepresentation has m rows and n columns (m and n are natural numbers)with respect to a long side or a short side of the image data, thepartial area is an area in a first column or an n-th column.
 6. Theimage processing apparatus according to claim 5, wherein, when theextracted diagrammatic representation has the m rows and the n columns(m and n are natural numbers) with respect to the long side or the shortside of the image data and when the erecting direction is not confirmedas a result of the character recognition for the first column that isexecuted, the n-th column is then set as the partial area.
 7. The imageprocessing apparatus according to claim 1, wherein, when the extracteddiagrammatic representation has m rows and n columns (m and n arenatural numbers) with respect to a long side or a short side of theimage data and when a width of a second column or a width of an (n−1)thcolumn is larger as a result of comparison between a width of a firstcolumn and the width of the second column and between a width of an n-thcolumn and the width of the (n−1)th column, the second column or the(n−1)th column is set as the partial area.
 8. The image processingapparatus according to claim 1, wherein, when the extracted diagrammaticrepresentation has m rows and n columns (m and n are natural numbers)with respect to a long side or a short side of the image data, thepartial area is an a-th column (1≤a≤n) that is a column having arelatively high frequency of presence of pixels as a result of thelayout analysis.
 9. The image processing apparatus according to claim 1,wherein, when the extracted diagrammatic representation has m rows and ncolumns (m and n are natural numbers) with respect to a long side or ashort side of the image data, the partial area is an a-th column (1≤a≤n)that is a widest column as a result of the layout analysis.
 10. Theimage processing apparatus according to claim 1, wherein, when theextracted diagrammatic representation extracted by the extraction parthas m rows and n columns (m and n are natural numbers) with respect to along side or a short side of the image data, the partial area is an a-thcolumn (1≤a≤n) that is a widest column having a relatively highfrequency of presence of pixels as a result of the layout analysis. 11.The image processing apparatus according to claim 1, wherein, when theextracted diagrammatic representation has m rows and n columns (m and nare natural numbers) with respect to a long side or a short side of theimage data, the partial area is an area including a plurality of rowsless than the in rows.
 12. The image processing apparatus according toclaim 1, wherein, when the extracted diagrammatic representation has mrows and n columns (m and n are natural numbers) with respect to a longside or a short side of the image data, the partial area is an areaincluding a plurality of columns less than the n columns.
 13. The imageprocessing apparatus according to claim 1, wherein the processorsequentially executes the character recognition for the character stringin the partial area and calculates a certainty factor of the characterrecognition, and wherein, when the certainty factor is equal to orlarger than a reference value, the processor decides the erectingdirection of the image data without executing the character recognitionfor a remaining part of the character string in the partial area by thecharacter recognizing part.
 14. The image processing apparatus accordingto claim 1, wherein the partial area is an area of a title of theextracted diagrammatic representation or, when the extracteddiagrammatic representation has in rows and n columns (m and n arenatural numbers), an area in a first row or an m-th row or an area in afirst column or an n-th column, and wherein the processor first executesthe character recognition for the area of the title of the diagrammaticrepresentation and, when the erecting direction of the image data is notdecided, then executes the character recognition for the area in thefirst row or the m-th row or executes the character recognition for thearea in the first column or the n-th column.
 15. The image processingapparatus according to claim 14, wherein, when the extracteddiagrammatic representation has the m rows and the n columns (m and nare natural numbers), the partial area is an area in a second column oran (n−1)th column, and wherein the processor executes the characterrecognition for the area in the first column or the n-th column and,when the erecting direction of the image data is not decided, executesthe character recognition for the area in the second column or the(n−1)th column.
 16. The image processing apparatus according to claim 1,wherein the diagrammatic representation comprises a table having thecharacter string, and wherein the processor detects a characterdirection of the character string in at least one of ahorizontally-oriented rectangular area and a vertically-orientedrectangular area of the table so as to determine the erecting directionof the image data.
 17. The image processing apparatus according to claim1, wherein the diagrammatic representation comprises a table having thecharacter string, and wherein the processor detects a characterdirection of the character string in an area near the table so as todetermine the erecting direction of the image data.
 18. A non-transitorycomputer readable medium storing a program causing a computer to executea process comprising: acquiring image data by reading a document;executing layout analysis for the image data; extracting a diagrammaticrepresentation from the image data by using a result of the layoutanalysis; executing character recognition for a partial area having ahigh probability of presence of a character string in a positionalrelationship with the extracted diagrammatic representation; anddeciding and outputting an erecting direction of the image data by usinga result of the character recognition for the partial area.